package com.my_musc_service.utils;

import org.apache.commons.io.FilenameUtils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @author Zhu Dunfeng
 * @date 2022/2/11 10:18
 */
public class FileTypeUtils {

    public static final String[] SONG_EXTENSION = {"mp3", "m4a", "mov", "wma", "aac", "flac", "wav", "ogg", "amr", "3gpp"};

    public static final String[] IMAGE_EXTENSION = {"bmp", "gif", "jpg", "jpeg", "png"};

    public static final String[] LYRIC_EXTENSION = {"lrc", "lyric"};

    public static boolean checkFileExtension(String fileExtension) {
        List<String> extensionList = new ArrayList<>();
        extensionList.addAll(Arrays.asList(SONG_EXTENSION));
        extensionList.addAll(Arrays.asList(IMAGE_EXTENSION));
        extensionList.addAll(Arrays.asList(LYRIC_EXTENSION));
        if (extensionList.contains(fileExtension)) {
            return true;
        }
        return false;
    }


}
